<%@ LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
'///////////////////////////////////////////////////////////////////////////////
'// 插件应用:    Z-Blog 1.8 Devo
'// 插件制作:    haphic(http://haphic.esloy.com)
'// 备    注:    Couple 参数设定
'// 最后修改：   2008-2-9
'// 最后版本:    0.4
'///////////////////////////////////////////////////////////////////////////////
%>
<% Option Explicit %>
<% On Error Resume Next %>
<% Response.Charset="UTF-8" %>
<% Response.Buffer=True %>
<!-- #include file="../../../c_option.asp" -->
<!-- #include file="../../../function/c_function.asp" -->
<!-- #include file="../../../function/c_function_md5.asp" -->
<!-- #include file="../../../function/c_system_lib.asp" -->
<!-- #include file="../../../function/c_system_base.asp" -->
<!-- #include file="../../../function/c_system_plugin.asp" -->
<!-- #include file="../../../function/c_system_event.asp" -->
<!-- #include file="../../../plugin/p_config.asp" -->
<%
Call System_Initialize()

'检查是否启用
If Not LCase(ZC_BLOG_THEME)=LCase("Couple") Then Call ShowError(48) 

	Dim LastBuildTime

	Application.Lock
	LastBuildTime=Application(ZC_BLOG_CLSID & "Couple_LastBuildTime")
	Application.UnLock

	If IsDate(LastBuildTime)=False Then

		LastBuildTime=LoadFromFile(BlogPath & "/THEMES/"& ZC_BLOG_THEME &"/PLUGIN/CACHE/index.html","utf-8")

		If IsDate(LastBuildTime)=False Then LastBuildTime=DateAdd("n",-(60+Couple_AutoBuildInterval),Now())

		Application.Lock
		Application(ZC_BLOG_CLSID & "Couple_LastBuildTime")=LastBuildTime
		Application.UnLock

	End If

	If DateDiff("n",LastBuildTime,Now()) >= Couple_AutoBuildInterval then

		Call Couple_BuildRandom("Male",Couple_MaleID)
		Call Couple_BuildRandom("Female",Couple_FemaleID)
		Call ClearGlobeCache()
		Call LoadGlobeCache()

		LastBuildTime=Now()

		Application.Lock
		Application(ZC_BLOG_CLSID & "Couple_LastBuildTime")=LastBuildTime
		Application.UnLock

		Call SaveToFile(BlogPath & "/THEMES/"& ZC_BLOG_THEME &"/PLUGIN/CACHE/index.html",LastBuildTime,"utf-8",False)


	End If

	Response.Write "document.write("""");"

Call System_Terminate()

If Err.Number<>0 then
  Call ShowError(0)
End If
%>

